package com.fxwater.websocket.job;

import cn.hutool.core.util.NumberUtil;

import java.text.DecimalFormat;
import java.util.regex.Pattern;

public class NumberUtils {



    public static String formatNumber(String numberValue){
        if(numberValue==null||"".equals(numberValue)||"null".equals(numberValue)){
            return null;
        } else if(NumberUtil.isNumber(numberValue)){
            return NumberUtil.roundStr(numberValue,2);
        } else {
            return numberValue;
        }

    }


    public static void main(String[] args) {

        String a ="0.125459556446";
        System.out.println(formatNumber(a));

        String b = "1265215646456416616116161656426265546.125446215145";
        System.out.println(formatNumber(b));

        String c="0.1235823565E-10";
        System.out.println(formatNumber(c));

        String d="0.123582356555658415748754148787E10";
        System.out.println(formatNumber(d));
    }
}
